package org.example.demoblg.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.example.demoblg.model.Blog;

import java.util.List;
@Mapper
public interface BlogInfo {
    @Select("select * from blog where delete_flag=0")
    List<Blog> getAll();
    @Select("select * from blog  where id=#{id} and delete_flag=0")
    Blog getById(Integer id);
    @Update("update blog  set delete_flag=1 where id=#{id}")
    int deleteById(Integer id);
    @Insert("insert into blog (title,content,user_id) values (#{title},#{content},#{userId})")
    int insert(Blog blog);
//    编辑 博客
    @Update("update blog set content=#{content},title=#{title}where id=#{id}")
    int update(Blog blog);


}
